/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.cggveritas.crewintranet.jms.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Alassane
 */
@Entity
@Table(name = "cv_formation")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CvFormation.findAll", query = "SELECT c FROM CvFormation c"),
    @NamedQuery(name = "CvFormation.findByIdformation", query = "SELECT c FROM CvFormation c WHERE c.idformation = :idformation"),
    @NamedQuery(name = "CvFormation.findByDatefinformation", query = "SELECT c FROM CvFormation c WHERE c.datefinformation = :datefinformation"),
    @NamedQuery(name = "CvFormation.findByDurevalidite", query = "SELECT c FROM CvFormation c WHERE c.durevalidite = :durevalidite")})
public class CvFormation implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idformation")
    private Integer idformation;
    @Column(name = "datefinformation")
    @Temporal(TemporalType.DATE)
    private Date datefinformation;
    @Column(name = "durevalidite")
    private Integer durevalidite;
    @Lob
    @Column(name = "commentaire")
    private String commentaire;
    @JoinColumn(name = "idtypeformation", referencedColumnName = "idtypeformation")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private CvTypeformation idtypeformation;
    @JoinColumn(name = "cv_travailleur_id", referencedColumnName = "id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private CvTravailleur cvTravailleurId;

    public CvFormation() {
    }

    public CvFormation(Integer idformation) {
        this.idformation = idformation;
    }

    public Integer getIdformation() {
        return idformation;
    }

    public void setIdformation(Integer idformation) {
        this.idformation = idformation;
    }

    public Date getDatefinformation() {
        return datefinformation;
    }

    public void setDatefinformation(Date datefinformation) {
        this.datefinformation = datefinformation;
    }

    public Integer getDurevalidite() {
        return durevalidite;
    }

    public void setDurevalidite(Integer durevalidite) {
        this.durevalidite = durevalidite;
    }

    public String getCommentaire() {
        return commentaire;
    }

    public void setCommentaire(String commentaire) {
        this.commentaire = commentaire;
    }

    public CvTypeformation getIdtypeformation() {
        return idtypeformation;
    }

    public void setIdtypeformation(CvTypeformation idtypeformation) {
        this.idtypeformation = idtypeformation;
    }

    public CvTravailleur getCvTravailleurId() {
        return cvTravailleurId;
    }

    public void setCvTravailleurId(CvTravailleur cvTravailleurId) {
        this.cvTravailleurId = cvTravailleurId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idformation != null ? idformation.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CvFormation)) {
            return false;
        }
        CvFormation other = (CvFormation) object;
        if ((this.idformation == null && other.idformation != null) || (this.idformation != null && !this.idformation.equals(other.idformation))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fr.cggveritas.crewintranet.jms.entities.CvFormation[ idformation=" + idformation + " ]";
    }
    
}
